package com.ysxsoft.wdg.adapter.center_zy;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ysxsoft.wdg.R;
import com.ysxsoft.wdg.bean.zy.RuleBean;
import java.util.List;

public class ZyFlLAdapter extends BaseQuickAdapter<RuleBean,BaseViewHolder> {


    public ZyFlLAdapter(int layoutResId) {
        super(layoutResId);
    }

    public void clear(){
        getData().clear();
        notifyDataSetChanged();
    }

    public void setSelect(int position){
        List<RuleBean> data = getData();
        for (int i = 0; i < data.size(); i++) {
            data.get(i).setSelected(i==position);
        }
        notifyDataSetChanged();
    }

    @Override
    protected void convert(BaseViewHolder helper, RuleBean item) {
        TextView tvName = helper.getView(R.id.tv_name);
        tvName.setText(item.getTitle());
        tvName.setSelected(item.isSelected());
    }
}
